#ifndef APPLICATIONS_COMMUNICATION_COMMUATION_H_
#define APPLICATIONS_COMMUNICATION_COMMUATION_H_

#include <rtthread.h>
#include <vector>
#include "threadunit/ThreadUnit.h"
extern "C" {
    #include "tcpserver.h"
}

using namespace std;

class Commuation
{
public:
    Commuation();
    virtual ~Commuation();

private:
    struct tcpserver* comm;
    const rt_uint16_t port = 9999;
    static rt_uint8_t buf[1024];
    static vector<ThreadUnit *>unitList;

private:
    static void commNotify(tcpclient_t client, rt_uint8_t event);
    static int unpack(const unsigned char *buf,size_t len);
};

#endif /* APPLICATIONS_COMMUNICATION_COMMUATION_H_ */
